#include "applyfriendresponsemessagetoclient.h"

ApplyFriendResponseMessageToClient::ApplyFriendResponseMessageToClient(const FriendId& friendId,
                const Nickname& nickname, const Status& status, const Alias& alias,
                const CreateTime& createTime, const Id& id)
{
    m_messageType = MessageType::ApplyFriendResponseToClient;
    m_friendId = friendId;
    m_nickname = nickname;
    m_status = status;
    m_alias = alias;
    m_createTime = createTime;
    m_id = id;
}

ApplyFriendResponseMessageToClient::ApplyFriendResponseMessageToClient(const QJsonObject& jsonObj)
{
    m_messageType = static_cast<MessageType>(jsonObj[JsonKey::TYPE].toInt());
    m_friendId = jsonObj[JsonKey::FRIEND_ID].toString();
    m_nickname = jsonObj[JsonKey::NICKNAME].toString();
    m_status = jsonObj[JsonKey::STATUS].toString();
    m_alias = jsonObj[JsonKey::ALIAS].toString();
    m_createTime = jsonObj[JsonKey::CREATE_TIME].toString();
    m_id = jsonObj[JsonKey::ID].toInt();
}

QJsonObject ApplyFriendResponseMessageToClient::PackJsonData() const
{
    QJsonObject jsonObj;
    jsonObj[JsonKey::TYPE] = static_cast<int>(m_messageType);
    jsonObj[JsonKey::FRIEND_ID] = m_friendId;
    jsonObj[JsonKey::NICKNAME] = m_nickname;
    jsonObj[JsonKey::STATUS] = m_status;
    jsonObj[JsonKey::ALIAS] = m_alias;
    jsonObj[JsonKey::CREATE_TIME] = m_createTime;
    jsonObj[JsonKey::ID] = m_id;
    return jsonObj;
}

FriendId ApplyFriendResponseMessageToClient::getFriendId() const
{
    return m_friendId;
}

Nickname ApplyFriendResponseMessageToClient::getNickname() const
{
    return m_nickname;
}

Status ApplyFriendResponseMessageToClient::getStatus() const
{
    return m_status;
}

Alias ApplyFriendResponseMessageToClient::getAlias() const
{
    return m_alias;
}

CreateTime ApplyFriendResponseMessageToClient::getCreateTime() const
{
    return m_createTime;
}

Id ApplyFriendResponseMessageToClient::getId() const
{
    return m_id;
}
